package acwing_01;

import java.util.Scanner;

public class _789_数的范围_暴力二分 {
	static int N = 100000;
	static int n;
	static int q;
	static int arr[] = new int[N];
	static StringBuilder stb = new StringBuilder();
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		q = scan.nextInt();
		
		for(int i = 0; i < n; i++) {
			arr[i] = scan.nextInt();
		}
		for(int i = 0; i < q; i++) {
			check(scan.nextInt());
		}
		System.out.print(stb.toString());
		scan.close();
		
		
	}
	
	public static void check(int k) {
		int l = 0;
		// 边界！
		int r = n - 1;
		int start;
		int end;
		int mid;
		while(l <= r) {
			mid = (r+l) / 2;

			if(arr[mid] == k) {
				start = mid;
				end = mid;
				while(true) {
					// 边界！
					if(end + 1 >= n) {
						break;
					}
					if(arr[++end] == k) {
						continue;
					}else {
						--end;
						break;
					}
				}
				
				while(true) {
					// 边界！
					if(start - 1 < 0) {
						break;
					}
					if(arr[--start] == k) {
						continue;
					}else {
						++start;
						break;
					}
				}
				stb.append(start + " " + end + "\n");
				return;
			} else if(k > arr[mid]) {
				l = mid + 1;
			} else {
				r = mid - 1;
			}
			
		}
		// 没找到
		stb.append("-1 -1\n");
		return;
		
		
		
	}
}
